package com.CmJava.controller;

import com.CmJava.entity.ResultEntity;
import com.CmJava.service.JwtService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JwtController {

    @Reference
    private JwtService jwtService;

    // 获取当前登录者的信息
    @PostMapping("compareJwt")
    public ResultEntity compareJwt(@RequestParam("userName") String userName,@RequestParam("token") String token){
        boolean flag = jwtService.compareJwt(userName, token);
        if (flag) {
            return ResultEntity.successWithoutMessage();
        }else {
            return ResultEntity.failureWithoutMessage();
        }
    }

}
